<template>
    <div>
      <div class="row">
        <div style="flex-shrink: 0;font-size: 14px;">序号：</div><el-input size="mini" style="width: 60px;margin-right: 20px;" v-model="nodeModel.sort"></el-input>
        <div style="flex-shrink: 0;font-size: 14px;">是否显示：</div><el-switch v-model="nodeModel.isShow" :active-value="true" :inactive-value="false" active-color="#13ce66" inactive-color="#999999"></el-switch>
      </div>
      <div class="row">
          <div style="flex-shrink: 0;font-size: 14px;margin-right: 10px;">标题：</div><el-input size="mini" style="width: 120px;margin-right: 20px;"  v-model="nodeModel.title"></el-input>
          <div style="flex-shrink: 0;font-size: 14px;">背景色：</div>
          <el-input size="mini" style="width: 100px;"  v-model="nodeModel.background"></el-input>
          <el-color-picker v-model="nodeModel.background"></el-color-picker>
      </div>
      <div class="column">
          <jcSlider title="上外边距："><el-slider slot="slider" v-model="nodeModel.marginTop" :min="0" :max="750" show-input input-size="mini"></el-slider></jcSlider>
          <jcSlider title="下外边距："><el-slider slot="slider" v-model="nodeModel.marginBottom" :min="0" :max="750" show-input input-size="mini"></el-slider></jcSlider>
          <jcSlider title="左右外边距："><el-slider slot="slider" v-model="nodeModel.marginLeft" :min="0" :max="750" show-input input-size="mini"></el-slider></jcSlider>
      </div>
      <div class="column">
          <jcSlider title="上内边距："><el-slider slot="slider" v-model="nodeModel.paddingTop" :min="0" :max="750" show-input input-size="mini"></el-slider></jcSlider>
          <jcSlider title="下内边距："><el-slider slot="slider" v-model="nodeModel.paddingBottom" :min="0" :max="750" show-input input-size="mini"></el-slider></jcSlider>
          <jcSlider title="左内边距："><el-slider slot="slider" v-model="nodeModel.paddingLeft" :min="0" :max="750" show-input input-size="mini"></el-slider></jcSlider>
      </div>
      <!-- 图文排列样式 -->
      <div style="border: 1px solid #eee;margin-top: 10px;padding: 10px 0;padding-right: 10px;">
        <div style="flex-shrink: 0;font-size: 14px;margin-left: 10px;font-size: 16px;font-weight: bold;">图文排列样式：</div>
        <div class="row">
          <div style="flex-shrink: 0;font-size: 14px;margin-right: 20px;">图文排列方向：</div>
          <el-radio v-model="nodeModel.flex_directionForFlex1" label='column'>上下</el-radio>
          <el-radio v-model="nodeModel.flex_directionForFlex1" label='column-reverse'>下上</el-radio>
          <el-radio v-model="nodeModel.flex_directionForFlex1" label='row'>左右</el-radio>
          <el-radio v-model="nodeModel.flex_directionForFlex1" label='row-reverse'>右左</el-radio>
        </div>
        <div class="row">
          <div style="flex-shrink: 0;font-size: 14px;margin-right: 20px;">图文对齐方式：</div>
          <el-radio v-model="nodeModel.align_itemsForFlex1" label='flex-start'>起点对齐</el-radio>
          <el-radio v-model="nodeModel.align_itemsForFlex1" label='center'>居中对齐</el-radio>
          <el-radio v-model="nodeModel.align_itemsForFlex1" label='flex-end'>终点对齐</el-radio>
        </div>
        <div class="row">
          <div style="flex-shrink: 0;font-size: 14px;">背景色：</div><el-input size="mini" style="width: 100px;"  v-model="nodeModel.backgroundForFlex1"></el-input>
          <el-color-picker v-model="nodeModel.backgroundForFlex1"></el-color-picker>
        </div>
        <div class="column">
          <jcSlider title="图文宽：" :titleWidth="80"><el-slider slot="slider" v-model="nodeModel.widthForFlex1" :min="10" :max="750" show-input input-size="mini"></el-slider></jcSlider>
          <jcSlider title="内上边距：" :titleWidth="80"><el-slider slot="slider" v-model="nodeModel.paddingTopForFlex1" :min="0" :max="200" show-input input-size="mini"></el-slider></jcSlider>
          <jcSlider title="内下边距：" :titleWidth="80"><el-slider slot="slider" v-model="nodeModel.paddingBottomForFlex1" :min="0" :max="200" show-input input-size="mini"></el-slider></jcSlider>
          <jcSlider title="内左边距：" :titleWidth="80"><el-slider slot="slider" v-model="nodeModel.paddingLeftForFlex1" :min="0" :max="200" show-input input-size="mini"></el-slider></jcSlider>
        </div>
        <div class="column">
          <jcSlider title="水平间距：" :titleWidth="80"><el-slider slot="slider" v-model="nodeModel.marginLeftForFlex1" :min="0" :max="100" show-input input-size="mini"></el-slider></jcSlider>
          <jcSlider title="垂直间距：" :titleWidth="80"><el-slider slot="slider" v-model="nodeModel.marginTopForFlex1" :min="0" :max="100" show-input input-size="mini"></el-slider></jcSlider>
        </div>
        <div class="column">
          <jcSlider title="图片宽：" :titleWidth="80"><el-slider slot="slider" v-model="nodeModel.widthForCover1" :min="10" :max="750" show-input input-size="mini"></el-slider></jcSlider>
          <jcSlider title="图片高：" :titleWidth="80"><el-slider slot="slider" v-model="nodeModel.heightForCover1" :min="10" :max="2000" show-input input-size="mini"></el-slider></jcSlider>
          <jcSlider title="图片圆角：" :titleWidth="80"><el-slider slot="slider" v-model="nodeModel.borderRadiusForCover1" :min="0" :max="500" show-input input-size="mini"></el-slider></jcSlider>
        </div>
        <div class="column" style="margin-top: 10px;align-items: flex-start;">
          <div style="flex-shrink: 0;font-size: 14px;">文本区域内边距：</div>
          <div>
            <jcSlider title="上：" :titleWidth="80"><el-slider slot="slider" v-model="nodeModel.paddingTopForFlex2" :min="0" :max="200" show-input input-size="mini"></el-slider></jcSlider>
            <jcSlider title="下：" :titleWidth="80"><el-slider slot="slider" v-model="nodeModel.paddingBottomForFlex2" :min="0" :max="200" show-input input-size="mini"></el-slider></jcSlider>
            <jcSlider title="左：" :titleWidth="80"><el-slider slot="slider" v-model="nodeModel.paddingLeftForFlex2" :min="0" :max="200" show-input input-size="mini"></el-slider></jcSlider>
            <jcSlider title="右：" :titleWidth="80"><el-slider slot="slider" v-model="nodeModel.paddingRightForFlex2" :min="0" :max="200" show-input input-size="mini"></el-slider></jcSlider>
          </div>
        </div>
        <!-- 标题样式 -->
        <div style="background-color: #eee;width: 600px;height: 1px;margin-left: 20px;margin-top: 10px;"></div>
        <div class="column">
          <div style="flex-shrink: 0;font-size: 14px;font-weight: bold;">标题样式：</div>
          <div class="row">
            <div style="flex-shrink: 0;font-size: 14px;">是否显示：</div>
            <el-radio v-model="nodeModel.isShowForText1" :label='true'>是</el-radio>
            <el-radio v-model="nodeModel.isShowForText1" :label='false'>否</el-radio>
            <div style="flex-shrink: 0;font-size: 14px;">是否加粗：</div>
            <el-radio v-model="nodeModel.fontweightForText1" label='bold'>是</el-radio>
            <el-radio v-model="nodeModel.fontweightForText1" label=''>否</el-radio>
          </div>
          <div class="row" style="margin-left: 50px;">
            <div style="flex-shrink: 0;font-size: 14px;">颜色：</div>
            <el-input size="mini" style="width: 100px;"  v-model="nodeModel.colorForText1"></el-input>
            <el-color-picker v-model="nodeModel.colorForText1"></el-color-picker>
          </div>
          <div class="column">
            <jcSlider title="上边距：" :titleWidth="70"><el-slider slot="slider" v-model="nodeModel.marginTopForText1" :min="0" :max="100" show-input input-size="mini"></el-slider></jcSlider>
            <jcSlider title="字体大小：" :titleWidth="70"><el-slider slot="slider" v-model="nodeModel.fontsizeForText1" :min="10" :max="100" show-input input-size="mini"></el-slider></jcSlider>
          </div>
        </div>
      </div>
      <!-- 图文列表内容区域 -->
      <div style="border: 1px solid #eee;padding: 10px;margin-top: 10px;">
        <div style="display: flex;flex-direction: row;margin-bottom: 10px;position: relative;margin-top: 20px;" v-for="(item, index) in nodeModel.advertList" :key='index'>
          <el-image
          style="width: 100px; height: 100px;flex-shrink: 0;"
          :src="item.coverUrl"
          fit="cover"></el-image>
          <div style="width: 100%;">
            <div style="margin-left: 10px;display: flex;flex-direction: row;">
              <div style="display: flex;flex-direction: row;align-items: center;"><div style="flex-shrink: 0;">序号：</div><el-input style="width: 60px;" v-model="item.sort"></el-input></div>
              <div style="display: flex;flex-direction: row;align-items: center;margin-left: 10px;"><div style="flex-shrink: 0;">标题：</div><el-input v-model="item.title"></el-input></div>
            </div>
            <div style="margin-left: 10px;margin-top: 10px;display: flex;flex-direction: row;">
              <div style="width: 100%;"><el-input style="margin-left: 0px;" v-model="item.coverUrl"></el-input></div>
              <custom :model="item" buttonTitle="选择文件"></custom>
            </div>
            <div style="margin-left: 10px;margin-top: 10px;display: flex;flex-direction: row;">
              <div style="width: 100%;"><el-input style="margin-left: 0px;" v-model="item.query"></el-input></div>
              <div><el-button @click="selectRoute(item)">路由参数</el-button></div>
            </div>
          </div>
          <div style="position: absolute;left: -15px;top: -15px;" @click="deleteAdvert(index)"><i class="el-icon-circle-close"></i></div>
        </div>
        <div style="width: 100%;"><el-button @click="insertAdvert">添加一个</el-button></div>
      </div>
    </div>
</template>

<script>
    import custom from '@/components/jcupload/custom'
    import jcSlider from '@/views/interface/composing/components/jc-slider'
  export default {
    components: {
        custom,
        jcSlider
    },
    props:{
        nodeModel:{
            type: Object,
            default: res=>{}
        }
    },
    data() {
      return {

      }
    },
    methods:{
        insertAdvert(){
            this.$emit('insertAdvert', {name: this.nodeModel.componentModel.name})
        },
        deleteAdvert(index){
            this.$emit('deleteAdvert', index)
        },
        selectRoute(item){
            this.$emit('selectRoute', item)
        }
    }
  }
</script>

<style lang="scss" scoped>
     @import './commonStyle.scss';
</style>